/*
 * ContasPagar.java
 *
 * Created on October 12, 2007, 10:45 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package petstore.model;

import petstore.model.enumeration.SituacaoContaPagar;
import java.util.Collection;
import java.util.Date;
import javax.persistence.AttributeOverride;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * Entity class ContasPagar
 * 
 * @author Tom Hayden
 */
@Entity
@Table(name = "contas_pagar")
@AttributeOverride(name="id", column=@Column(name="cdcontapagar"))
public class ContaPagar extends BusinessObject {

    @Column(name = "dtemissaoctapagar")
    @Temporal(TemporalType.TIMESTAMP)
    private Date dataEmissao;

    @Column(name = "vlrtotctapagar")
    private Double valorTotal;

    @Column(name = "stcontapagar")
    @Enumerated(EnumType.ORDINAL)
    private SituacaoContaPagar situacaoContaPagar;

    @Column(name = "ativo")
    private boolean active;

    @ManyToOne
    @JoinColumn(name="cdcompra")
    private Compra compra;

    @ManyToOne
    @JoinColumn(name="cdfornecedor")
    private Fornecedor fornecedor;

    @ManyToOne
    @JoinColumn(name="cdcontacontabil")
    private ContaContabil contaContabil;

    @OneToMany(cascade = CascadeType.ALL)
    private Collection<ParcelaPagar> parcelas;
    
    /** Creates a new instance of ContasPagar */
    public ContaPagar() {
    }

    public Date getDataEmissao() {
        return dataEmissao;
    }

    public void setDataEmissao(Date dataEmissao) {
        this.dataEmissao = dataEmissao;
    }

    public Double getValorTotal() {
        return valorTotal;
    }

    public void setValorTotal(Double valorTotal) {
        this.valorTotal = valorTotal;
    }

    public SituacaoContaPagar getSituacaoContaPagar() {
        return situacaoContaPagar;
    }

    public void setSituacaoContaPagar(SituacaoContaPagar situacaoContaPagar) {
        this.situacaoContaPagar = situacaoContaPagar;
    }

    public boolean isActive() {
        return active;
    }

    public void setActive(boolean active) {
        this.active = active;
    }

    public Compra getCompra() {
        return compra;
    }

    public void setCompra(Compra compra) {
        this.compra = compra;
    }

    public Fornecedor getFornecedor() {
        return fornecedor;
    }

    public void setFornecedor(Fornecedor fornecedor) {
        this.fornecedor = fornecedor;
    }

    public ContaContabil getContaContabil() {
        return contaContabil;
    }

    public void setContaContabil(ContaContabil contaContabil) {
        this.contaContabil = contaContabil;
    }

    public Collection<ParcelaPagar> getParcelas() {
        return parcelas;
    }

    public void setParcelas(Collection<ParcelaPagar> parcelas) {
        this.parcelas = parcelas;
    }

}
